package com.teacher.pc.controller;


import com.teacher.common.CommonResult;
import com.teacher.pojo.dto.moraleducation.MoralEducationAddDto;
import com.teacher.pojo.dto.moraleducation.MoralEducationUpdateDto;
import com.teacher.pojo.vo.moraleducationtask.MoralEducationGetVo;
import com.teacher.service.IMoralEducationTaskService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 德育素质审批表 前端控制器
 * </p>
 *
 * @author zfm
 * @since 2021-08-03
 */
@RestController
@RequestMapping("/pc/moral-education-task")
@Api(tags = "德育素质审批表")
public class MoralEducationTaskController {

    @Autowired
    private IMoralEducationTaskService iMoralEducationTaskService;


    /**
     * 发起德育素质审批流程
     *
     * @param dto
     * @return
     */
    @PostMapping
    @ApiOperation("发起德育素质审批流程 10->校级优秀团干 20->校级优秀团员 30->院级优秀党员 40->院级优秀团干 50->院级优秀团员 60->院级优秀学生干部->70 其它->80")
    public CommonResult<String> add(@RequestBody MoralEducationAddDto dto) {
        return iMoralEducationTaskService.add(dto);
    }

    /**
     * 更新流程
     *
     * @param dto
     * @return
     */
    @PutMapping
    @ApiOperation("更新流程")
    public CommonResult<String> update(@RequestBody MoralEducationUpdateDto dto) {
        return iMoralEducationTaskService.updateInfo(dto);
    }

    /**
     * 获取详情
     *
     * @return
     */
    @GetMapping("/{flowId}")
    @ApiOperation("获取详情")
    public CommonResult<MoralEducationGetVo> getDetails(@PathVariable("flowId") Long id) {
        return iMoralEducationTaskService.getDetails(id);
    }

}

